<!DOCTYPE HTML>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">
    
     <div class="container-div">
		<div class="row">
			<div class="col-sm-12 search-collapse">
				<form id="formId">
				<input type="hidden" th:value="${contest.contestId}" name="contestId"/>
				</form>
				<h1 align="center">[[${contest.title}]]</h1>
				<h3 align="center">开始时间：[[${#dates.format(contest.startTime,'yyyy-MM-dd HH:mm:ss')}]]</h3>
				<span class="text-muted">
                <th:block th:include="common :: countdown" />
                </span>
				<h3 align="center">结束时间：[[${#dates.format(contest.endTime,'yyyy-MM-dd HH:mm:ss')}]]</h3>
			</div>

			<div class="col-sm-12 select-table table-striped">
				<table id="bootstrap-table" data-mobile-responsive="true"></table>
			</div>
		</div>
	</div>
    <div th:include="include :: footer"></div>
    <script th:inline="javascript">
        var prefix = ctx + "acm/contestProblem";

        $(function() {
            var options = {
                url: prefix + "/list",
                modalName: "acm竞赛题目",
				search: false,
		        showExport: false,
                columns: [
				{
					field : 'num', 
					title : '题目序号'
				},
				{
					field : 'title', 
					title : '题目名称',
					formatter: function(value, row, index) {
						var actions = [];
                        actions.push('<a class="btn btn-success btn-xs" href="#" onclick="goproblem('+ row.problemId+',' +row.contestId+ ')" ><i class="fa fa-link"></i>'+value+'</a>  ');
                        return actions.join('');
					}
				},
				{
					field : 'submit', 
					title : '提交次数'
				},
				{
					field : 'accepted', 
					title : 'AC次数'
				},
				{
					field : 'solved', 
					title : '解决次数'
				}]
            };
            $.table.init(options);
        });
        function goproblem(pid,cid){
        	var url = ctx + 'acm/front/detail?problemId='+ pid + '&contestId='+cid;
			$.modal.openTab("题目详情", url);
			refreshItem();
        }        
    </script>
<script th:src="@{/assets/js/timecountdown.js}"></script>
    <script>
    $(function(){
    	var maxtime=[[${maxtime}]];
    	if(maxtime==0) {
    		document.getElementById("h4").innerHTML="已";
            document.getElementById("i4").innerHTML="结";
            document.getElementById("s4").innerHTML="束";
    	}
    	else if(maxtime==-1) {
    		document.getElementById("h4").innerHTML="未";
            document.getElementById("i4").innerHTML="开";
            document.getElementById("s4").innerHTML="始";
    	}
    	else
    	xcsoft.countdown3('[[${now0}]]','[[${#dates.format(contest.endReg,"yyyy-MM-dd HH:mm:ss")}]]',function (time) {
            document.getElementById("h4").innerHTML=time.hourZero;
            document.getElementById("i4").innerHTML=time.minuteZero;
            document.getElementById("s4").innerHTML=time.secondZero;
        });
    })
    </script>    
</body>
</html>